Repository navigation
Conversation
roji
force-pushed
the
main
branch
9 times, most recently
from
February 16, 2026 16:00
79fae3a to
f894de9
Compare
roji
force-pushed
the
main
branch
2 times, most recently
from
February 25, 2026 14:25
75c2ea9 to
d038259
Compare
|
please when this gets done? or any workaround? |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The translator excludes immutable dictionary indexers despite the provider supporting their hstore mapping.
1 open issue
What changed in this PR
Adds hstore dictionary-indexer translation to the PostgreSQL query pipeline, allowing key lookups in LINQ predicates and projections without raw SQL.
Changes:
- Translates dictionary indexing into PostgreSQL’s
->operator. - Integrates string type mapping, SQL generation, and nullable lookup results.
- Adds functional tests for key expressions, projections, string operations, and null semantics.
| File | Description |
|---|---|
| test/EFCore.PG.FunctionalTests/Query/Translations/HstoreTranslationsTest.cs | Tests lookup results and generated SQL. |
| src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs | Assigns lookup operand and result mappings. |
| src/EFCore.PG/Query/Internal/NpgsqlSqlNullabilityProcessor.cs | Treats hstore lookup results as nullable. |
| src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs | Emits the -> operator. |
| src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMethodCallTranslatorProvider.cs | Registers the hstore translator. |
| src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlHstoreTranslator.cs | Translates mapped dictionary indexers. |
| src/EFCore.PG/Query/Expressions/PgExpressionType.cs | Defines the hstore lookup expression kind. |
| src/EFCore.PG/Query/Expressions/Internal/PgBinaryExpression.cs | Adds diagnostic printing for hstore lookups. |
Review effort: Balanced
| IReadOnlyList<SqlExpression> arguments, | ||
| IDiagnosticsLogger<DbLoggerCategory.Query> logger) | ||
| => method is { Name: "get_Item", DeclaringType: var declaringType } | ||
| && declaringType == typeof(Dictionary<string, string>) |
| return null; | ||
| } | ||
|
|
||
| return _sqlExpressionFactory.JsonTraversal(instance, arguments, false, typeof(string), _stringTypeMapping); |
Member
|
Sorry for not reviewing this earlier. As this PR has some issues (the usage of the JSON traversal operator is problematic) and is already fully covered by #3285, I'll focus on the latter and go ahead and close this one. Thanks for your work here and sorry again that it wasn't reviewed in a timely manner. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


for example:
a["b"]will translate to"a" -> 'b'If there is no translator, using the values of fields with the hstore type as a WHERE condition would be very cumbersome, and can only be achieved using
FromSqlRaw.`